//
//  DJOANetWorkRequest.h
//  AFNetworking
//
//  Created by 陈樟权 on 2020/6/1.
//

#import <Foundation/Foundation.h>
#import "AFURLRequestSerialization.h"
///  HTTP Request method.
typedef NS_ENUM(NSInteger, DJOANetWorkRequestMethod) {
    DJOANetWorkRequestMethodGET = 0,
    DJOANetWorkRequestMethodPOST
};

///  Request serializer type.
typedef NS_ENUM(NSInteger, DJOANetWorkRequestSerializerType) {
    DJOANetWorkRequestSerializerTypeHTTP = 0,
    DJOANetWorkRequestSerializerTypeJSON,
};

///  Response serializer type, which determines response serialization process and
///  the type of `responseObject`.
typedef NS_ENUM(NSInteger, DJOANetWorkResponseSerializerType) {
    /// NSData type
    DJOANetWorkResponseSerializerTypeHTTP,
    /// JSON object type
    DJOANetWorkResponseSerializerTypeJSON,
    /// NSXMLParser type
    DJOANetWorkResponseSerializerTypeXMLParser,
};

NS_ASSUME_NONNULL_BEGIN

@class DJOANetWorkRequest;

typedef void(^DJOANetWorkRequestConstructingBlock)(id<AFMultipartFormData> formData);
typedef void(^DJOANetWorkRequestCompletionBlock)(__kindof DJOANetWorkRequest *request);
typedef void(^DJOANetWorkRequestCompletionBlock)(__kindof DJOANetWorkRequest *request);


@interface DJOANetWorkRequest : NSObject

@property(nonatomic,assign)DJOANetWorkRequestMethod requestMethod;
@property(nonatomic,assign)DJOANetWorkRequestSerializerType requestSerializerType;
@property(nonatomic,assign)DJOANetWorkResponseSerializerType responseSerializerType;

@property(nonatomic,copy)NSString *baseUrl;
@property(nonatomic,copy)NSDictionary *param;
@property(nonatomic,copy)NSDictionary *header;

@property(nonatomic,assign)NSInteger reqeustTimeoutInterval;

@property (nonatomic, copy, nullable) DJOANetWorkRequestConstructingBlock constructingBodyBlock;

@property (nonatomic, copy, nullable) DJOANetWorkRequestCompletionBlock successCompletionBlock;
@property (nonatomic, copy, nullable) DJOANetWorkRequestCompletionBlock failureCompletionBlock;


@property (nonatomic, strong) id responseObject;

@property (nonatomic, assign) BOOL enableLog;//default is YES;


//-(void)start;

-(void)startWithCompletionBlockWithSuccess:(nullable DJOANetWorkRequestCompletionBlock)success failure:(nullable DJOANetWorkRequestCompletionBlock)failure;


@end

NS_ASSUME_NONNULL_END
